package com.admin.service.impl;

import com.admin.entity.Dormitory;
import com.admin.dao.DormitoryMapper;
import com.admin.service.DormitoryService;
import com.admin.vo.query.DormitoryQueryVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 宿舍表 服务实现类
 * </p>
 *
 * @author szy
 * @since 2023-03-02
 */
@Service
public class DormitoryServiceImpl extends ServiceImpl<DormitoryMapper, Dormitory> implements DormitoryService {

    @Override
    public IPage<Dormitory> getDormitoryByPage(IPage<Dormitory> page, DormitoryQueryVo dormitoryQueryVo) {
        QueryWrapper<Dormitory> queryWrapper = new QueryWrapper<Dormitory>();
        //楼幢
        queryWrapper.like(!ObjectUtils.isEmpty(dormitoryQueryVo.getBuilding()),
                "building",dormitoryQueryVo.getBuilding());
        return baseMapper.selectPage(page,queryWrapper);
    }
}
